import basegraphunit from './basegraphunit.js'
import coorPkg from '../../struct/coord.js'

class MultiStarUnit extends basegraphunit.BaseGraphUnit {
    constructor() {
        super();
        this.pos = new coorPkg.MultiPos();
        this.x = 0;
        this.y = 0;
        this.angle = 0;
        this.width = 0;
        this.height = 0;
        this.innerRadius = 0;
        this.starCount = 3;
    }

    translateSubInfo(tx,ty){
        this.x += tx;
        this.y += ty;
    }

    toJson() {
        var jsonobj = {};
        super.toJson(jsonobj);
        jsonobj["x"] = this.x;
        jsonobj["y"] = this.y;
        jsonobj["width"] = this.width;
        jsonobj["height"] = this.height;
        jsonobj["innerRadius"] = this.innerRadius;
        jsonobj["starCount"] = this.starCount;
        return jsonobj;
    }
    fromJson(obj) {
        super.fromJson(obj);
        this.x = obj["x"];
        this.y = obj["y"];
        this.width = obj["width"];
        this.height = obj["height"];
        this.innerRadius = obj["innerRadius"];
        this.starCount = obj["starCount"];
    }

    cloneCopy() {
        var pNewInfo = new MultiStarUnit();
        super.cloneCopy(pNewInfo);
        pNewInfo.x = this.x;
        pNewInfo.y = this.y;
        pNewInfo.width = this.width;
        pNewInfo.height = this.height;
        pNewInfo.innerRadius = this.innerRadius;
        pNewInfo.starCount = this.starCount;
        return pNewInfo;
    }
}

export default { MultiStarUnit }